package com.mnsq.common.tools.tool;

import org.springframework.core.io.ClassPathResource;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class FileLoadUtils {

    public static String[] permitUrls() {
        List<String> list = new ArrayList<>();
        try {
            ClassPathResource classPathResource = new ClassPathResource("permit_urls");
            InputStream inputStream = classPathResource.getInputStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "utf-8"));
            String line;
            while ((line = reader.readLine()) != null) {
                list.add(line);
            }
            return list.toArray(new String[list.size()]);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return new String[1];
    }
}
